package com.hsgene.product.service;

import com.hsgene.common.util.result.ApiResult;
import com.hsgene.common.util.support.Pagination;
import com.hsgene.product.dto.QuerySetMealDto;
import com.hsgene.product.dto.SetMealDto;
import org.elasticsearch.index.reindex.BulkByScrollTask;
import org.elasticsearch.rest.RestStatus;

/**
 * @description:
 * @projectName: hdas-geneshop-server
 * @package: com.hsgene.product.service
 * @author: maodi
 * @createDate: 2018/10/22 15:03
 * @version: 1.0
 * Copyright: Copyright (c) 2018
 */
public interface ElasticsearchService {

    /**
     * @param setMealDto 套餐数据
     * @return org.elasticsearch.rest.RestStatus
     * @description 新增数据
     * @author maodi
     * @createDate 2018/10/26 11:51
     */
    RestStatus addSetMealDto(SetMealDto setMealDto);

    /**
     * @param id 套餐id
     * @return org.elasticsearch.rest.RestStatus
     * @description 根据id删除套餐数据
     * @author maodi
     * @createDate 2018/10/26 11:51
     */
    RestStatus deleteSetMealDto(String id);

    /**
     * @param setMealDto 套餐数据
     * @return org.elasticsearch.rest.RestStatus
     * @description 修改套餐数据
     * @author maodi
     * @createDate 2018/10/26 11:51
     */
    RestStatus updateSetMealDto(SetMealDto setMealDto);

    /**
     * @param id 套餐id
     * @return com.hsgene.product.dto.SetMealDto
     * @description
     * @author maodi
     * @createDate 2018/10/22 16:01
     */
    SetMealDto searchById(String id);

    /**
     * @param setMeal 套餐查询
     * @return com.hsgene.common.util.result.ApiResult<com.hsgene.common.util.support.Pagination<com.hsgene.product
     * .dto.SetMealDto>>
     * @description
     * @author maodi
     * @createDate 2018/10/26 10:13
     */
    ApiResult<Pagination<SetMealDto>> search(QuerySetMealDto setMeal);


    /**
     * @param queryName 查询的名字
     * @param queryValue 查询的字
     * @param idOrCode for(HashMap m : ctx._source.org) {if(m.get('name') == '云芝糖肽1'){m.put('name','云芝糖肽')}}
     * @return org.elasticsearch.index.reindex.BulkByScrollTask.Status
     * @description 查询更新elasticsearch
     * @author maodi
     * @createDate 2019/1/3 15:59
     */
    BulkByScrollTask.Status updateByQuery(String queryName, String queryValue, String idOrCode);
}
